package com.youyoulong.framework.util.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.youyoulong.framework.util.service.IFrameDataInterfaceService;

@Controller
@RequestMapping(value = "/util")

public class UtilController {
	
	@Resource(name = "util.main.FrameDataInterfaceService")
	IFrameDataInterfaceService dataInterfaceService;  

	@SuppressWarnings({ "rawtypes", "unchecked"})
	@RequestMapping(value = "/data/execute/{dataCode}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
	public @ResponseBody Object executePost(@PathVariable("dataCode") String dataCode,@RequestBody Map params, HttpSession session, HttpServletRequest request)
			throws Exception {
		params.put("dataCode", dataCode);
		return dataInterfaceService.execute(params);
	}

}
